package com.climber.android.commonres.widget.indicator

import android.content.Context
import android.widget.LinearLayout
import android.widget.TextView
import androidx.fragment.app.FragmentManager
import com.climber.android.commonres.ui.BaseMVPFragment
import io.ganguo.library.mvp.util.UIUtils

/**
 * Created by Mikes at 2020-04-01 10:28
 */
open class DefaultPagerTabAdapter(context: Context, fragments: List<BaseMVPFragment<*>>, titleArray: List<String>, fragmentManager: FragmentManager)
    : AbstractPagerTabTemplateAdapter(context, fragments, titleArray, fragmentManager){

    override fun changeTextViewStyle(textView: TextView, position : Int) {
        val newLayoutParams = textView.layoutParams as LinearLayout.LayoutParams
        newLayoutParams.leftMargin = UIUtils.dip2Px(5)
        newLayoutParams.rightMargin = UIUtils.dip2Px(5)
        newLayoutParams.topMargin = UIUtils.dip2Px(8)
        newLayoutParams.bottomMargin = UIUtils.dip2Px(8)
        textView.layoutParams = newLayoutParams

        textView.textSize = 14F
        textView.width = getTextWidth(textView) + UIUtils.dip2Px(15)
    }
}